package com.yulongtian.offers.day202302;

/**
 * https://leetcode.cn/problems/percentage-of-letter-in-string/
 * 可
 *
 * @author yulongTian
 * @create 2023-02-07 17:37
 */
public class Test05 {
    public static void main(String[] args) {

    }

    public static int percentageLetter(String s, char letter) {
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == letter) {
                num++;
            }
        }
        return (int) (100.0 * num / s.length());
    }
}
